﻿using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using Kevin.Shop.Business.Core.Components.Cookie;
using Kevin.Shop.Business.Core.Components.Responser;
using Kevin.Shop.Business.Core.Member;
using Kevin.Shop.Business.Core.ServiceContract;
using Kevin.Shop.Business.Service.Entity.Helper;
using RiderShop.Mobile.Common.Component;
using RiderShop.Mobile.Common.Component.OAuth.Weixing;
using RiderShop.Mobile.Common.ThirdEntity;
using RiderShop.Mobile.Modle.Home;
using RiderShop.Mobile.ServiceEntity.Store;

namespace RiderShop.WebSite.Controllers
{
    public class HomeController : ThemeController
    {
        public ActionResult Index()
        {

            var index = new IndexViewModel(5);

            return View(WebClientContext.Current.SiteTheme, "Home", "Index", WebClientContext.Current.CacheKeyDefaultMasterPage, index);
        }

        [ChildActionOnly]
        public ActionResult BannerPartial()
        {
            return PartialView("BannerPartial", new HomeBannerViewModel());
        }


        public JsonResult GetTopBanner()
        {
            var banner = new HomeBannerViewModel();
            var bigBanner = banner.Site_Top01Image;
            var simallBanner = banner.Site_Top01_SmallImage;
            var result = new AdvertisementImageExtend[] { bigBanner, simallBanner };
            return Json(result, JsonRequestBehavior.AllowGet);

        }

        [ChildActionOnly]
        public ActionResult PromotonPartial()
        {
            return PartialView("PromotonPartial", new HonePromotionViewModel());
        }

        [ChildActionOnly]
        public ActionResult SearchPartial()
        {
            return PartialView("SearchPartial");
        }

        [ChildActionOnly]
        public ActionResult SiteMapInfoPartial()
        {
            return PartialView(string.Format("~/Themes/{0}/Views/Home/SiteMapInfoPartial.cshtml", WebClientContext.Current.SiteTheme), new SiteMapInfoViewModel());
        }
    }
}
